package com.geekcoding.geekoj.dto;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.geekcoding.common.enums.Sex;
import com.geekcoding.geekoj.entity.UserEntity;
import com.geekcoding.geekoj.nums.Role;
import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class User {

    private String id;

    private String stuNo;

    private String cellphone;

    private String name;

    private String nickName;

    private Sex sex;

    private Role role;

    private String token;

    public static User of(UserEntity userEntity, String token) {
        User user = User.builder().build();
        BeanUtil.copyProperties(userEntity, user);
        user.setToken(token);
        return user;
    }
}
